package com.itheima.shengxiao3;

import com.itheima.shengxiao2.Desk;

import java.util.concurrent.ArrayBlockingQueue;

public class Ganfanren implements Runnable {
    private ArrayBlockingQueue<String> queue;

    public Ganfanren(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            String take = null;
            try {
                Thread.sleep(5000);
                take = queue.take();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"吃了"+take);


        }

    }
}
